# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=gwtenum
pkgver=7.f27a5aa
pkgrel=7
epoch=1
pkgdesc='Enumeration of GWT-RCP method calls.'
url='http://www.gdssecurity.com/l/t/d.php?k=GwtEnum'
groups=('blackarch' 'blackarch-recon' 'blackarch-webapp')
license=('CCPL')
arch=('any')
depends=('python2')
makedepends=('git')
source=("$pkgname::git+https://github.com/GDSSecurity/GWT-Penetration-Testing-Toolset.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  _tools="gwtenum gwtfuzzer gwtparse"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -r * "$pkgdir/usr/share/$pkgname/"

  for tool in $_tools ; do
    cat > "$pkgdir/usr/bin/$tool" << EOF
#!/bin/sh
cd /usr/share/gwtenum/$tool
exec python2 $tool.py "\$@"
EOF
    chmod 755 "$pkgdir/usr/bin/$tool"
  done
}

